@model Easy.RepositoryPattern.Pagination

<ul class="pagination">
    @if (Model.PageIndex >= 1)
    {
        <li><a href="@Url.Page(0)"><i class="glyphicon glyphicon-chevron-left"></i></a></li>
    }
    else
    {
        <li class="disabled"><a href="javascript:void(0)"><i class="glyphicon glyphicon-chevron-left"></i></a></li>
    }
    @{
        if (Model.PageIndex >= 5)
        {
            <li>
                <a>...</a>
            </li>
        }
        int start = Model.PageIndex - 4;
        int end = Model.PageIndex + 4;
        if (start < 0)
        {
            start = 0;
        }
        for (; start < Model.AllPage && start <= end; start++)
        {
            <li class="@(start == Model.PageIndex ? "active" : "")">
                <a href="@Url.Page(start)">@(start + 1)</a>
            </li>
        }
        if (Model.AllPage - Model.PageIndex > 5)
        {
            <li>
                <a>...</a>
            </li>
        }
    }

    @if (Model.PageIndex < Model.AllPage - 1)
    {
        <li>
            <a href="@Url.Page(Model.PageIndex + 1)"><i class="glyphicon glyphicon-chevron-right"></i></a>
        </li>
    }
    else
    {
        <li class="disabled">
            <a href="javascript:void(0)"><i class="glyphicon glyphicon-chevron-right"></i></a>
        </li>
    }
</ul>
